//
//  Person.m
//  MyProject
//
//  Created by yun on 2018/4/18.
//  Copyright © 2018年 yun. All rights reserved.
//

#import "Person1.h"
#import <objc/runtime.h>

static char nameKey;

@implementation Person1

- (void)setPersonName:(NSString *)name{
    objc_setAssociatedObject(self, &nameKey, name, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)dosome{
    NSString *name = objc_getAssociatedObject(self, &nameKey);
    if (name) {
        NSLog(@"我的名字是%@",name);
    } else{
        NSLog(@"我还没有名字");
    }
    
    
}

@end
